package com.soul.facade;

import com.soul.model.DemoUser;
import org.springframework.web.bind.annotation.*;


@RestController
public class MainController {

    @GetMapping("/")
    public String ok() {
        System.out.println("ok");
        return "ok";
    }

    // x-www-form-urlencoded
    @RequestMapping(value = "/userForm", produces = "application/json;charset=utf-8")
    @ResponseBody
    public DemoUser getUserForm(DemoUser user) {
        System.out.println(user);
        return user;
    }

    // raw json
    @RequestMapping(value = "/userJson", produces = "application/json;charset=utf-8")
    @ResponseBody
    public DemoUser getUserJson(@RequestBody DemoUser user) {
        System.out.println(user);
        return user;
    }

}

